package com.robot.member.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.robot.member.pojo.AgentApply;

import java.util.List;

/**
 * 代理商入驻申请agent_apply数据访问接口
 *
 * @author wuyunbin
 */
public interface AgentApplyDao extends JpaRepository<AgentApply, String>, JpaSpecificationExecutor<AgentApply> {
    /**
     * 通过memberId查询最新agent_apply详情
     *
     * @param memberId
     * @return
     */
    public AgentApply findTopByMemberIdOrderByCreatedAtDesc(String memberId);

    /**
     * 通过phone查询agent_apply列表
     *
     * @param phone
     * @return
     */
    public List<AgentApply> findAllByPhone(String phone);

    /**
     * 通过id和memberId查询最新agent_apply详情
     *
     * @param id
     * @param memberId
     * @return
     */
    public AgentApply findByIdAndMemberIdAndDeletedAtIsNull(String id, String memberId);
}